﻿
namespace Wechat.Results
{
    /// <summary>
    /// 音乐回复
    /// </summary>
    public class WechatMusicResult : WechatResult
    {
        public WechatMusicResult(string toUsername, string fromUsername)
            : base(toUsername, fromUsername)
        {

        }

        /// <summary>
        /// 标题
        /// </summary>
        public string Title { get; set; }

        /// <summary>
        /// 音频地址
        /// </summary>
        public string MusicURL { get; set; }
        
        /// <summary>
        /// 高音质音频地址
        /// </summary>
        public string HQMusicUrl { get; set; }
        
        /// <summary>
        /// 描述
        /// </summary>
        public string Description { get; set; }
        
        /// <summary>
        /// 缩略图
        /// </summary>
        public string ThumbMediaId { get; set; }

        protected override void Format(System.Text.StringBuilder builder)
        {
            builder.Append("<MsgType><![CDATA[music]]></MsgType>");

            builder.Append("<Music>");
            
            builder.AppendFormat("<Title><![CDATA[{0}]]></Title>", Title);
            
            builder.AppendFormat("<MusicURL><![CDATA[{0}]]></MusicURL>", MusicURL);
            
            builder.AppendFormat("<HQMusicUrl><![CDATA[{0}]]></HQMusicUrl>", HQMusicUrl);
            
            builder.AppendFormat("<Description><![CDATA[{0}]]></Description>", Description);
            
            builder.AppendFormat("<ThumbMediaId><![CDATA[{0}]]></ThumbMediaId>", ThumbMediaId);
            
            builder.Append("</Music>");
        }
    }
}
